/*     */ package com.feeyin.radar.sys.controller;
/*     */ 
/*     */ import com.feeyin.radar.commons.StringUtils;
/*     */ import com.feeyin.radar.sys.service.WarningService;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.springframework.web.servlet.ModelAndView;
/*     */ import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
/*     */ import org.springframework.web.servlet.view.RedirectView;
/*     */ 
/*     */ public class WarningManageController extends MultiActionController
/*     */ {
/*     */   private WarningService warningService;
/*     */   private String warningManage;
/*     */   private String warningObject;
/*     */ 
/*     */   public WarningService getWarningService()
/*     */   {
/*  30 */     return this.warningService;
/*     */   }
/*     */ 
/*     */   public void setWarningService(WarningService warningService) {
/*  34 */     this.warningService = warningService;
/*     */   }
/*     */ 
/*     */   public String getWarningManage() {
/*  38 */     return this.warningManage;
/*     */   }
/*     */ 
/*     */   public void setWarningManage(String warningManage) {
/*  42 */     this.warningManage = warningManage;
/*     */   }
/*     */ 
/*     */   public String getWarningObject() {
/*  46 */     return this.warningObject;
/*     */   }
/*     */ 
/*     */   public void setWarningObject(String warningObject) {
/*  50 */     this.warningObject = warningObject;
/*     */   }
/*     */ 
/*     */   public ModelAndView display(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  55 */     Map model = new HashMap();
/*  56 */     model.put("result", request.getParameter("result"));
/*  57 */     model.put("warningPlan", this.warningService.getWarningPlan());
/*  58 */     model.put("warningWay", this.warningService.getWarningWay());
/*  59 */     return new ModelAndView(getWarningManage(), model);
/*     */   }
/*     */ 
/*     */   public ModelAndView warningObject(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  64 */     Map model = new HashMap();
/*  65 */     String warningItem = request.getParameter("warningItem");
/*  66 */     if (!StringUtils.isEmpty(warningItem)) {
/*  67 */       model.put("roles", this.warningService.getRoleUsers());
/*  68 */       model.put("warningItem", warningItem);
/*  69 */       String warningObjects = request.getParameter("warningItem" + warningItem);
/*  70 */       model.put("warningObjects", warningObjects);
/*     */     }
/*  72 */     return new ModelAndView(getWarningObject(), model);
/*     */   }
/*     */ 
/*     */   public ModelAndView startWarning(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  77 */     boolean result = false;
/*  78 */     int success = 0;
/*  79 */     String[] warningItems = request.getParameterValues("warningItem");
/*  80 */     String[] warningWays = request.getParameterValues("warningWay");
/*  81 */     if ((warningItems != null) && (warningItems.length > 0) && 
/*  82 */       (warningWays != null) && (warningWays.length > 0))
/*     */     {
/*  84 */       result = this.warningService.insertWarningWay(warningWays);
/*     */ 
/*  86 */       for (int i = 0; i < warningItems.length; i++) {
/*  87 */         String warningObjects = request.getParameter("warningItem" + warningItems[i]);
/*     */ 
/*  89 */         this.warningService.insertWarningItem(warningItems[i], warningObjects);
/*     */       }
/*  91 */       if (result) success = 1;
/*     */     }
/*  93 */     return new ModelAndView(new RedirectView("./warningManage.do?action=display&result=" + success));
/*     */   }
/*     */ 
/*     */   public ModelAndView stopWarningPlan(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  98 */     boolean result = false;
/*  99 */     int success = 0;
/* 100 */     result = this.warningService.stopWarningPlan();
/* 101 */     if (result) success = 2;
/* 102 */     return new ModelAndView(new RedirectView("./warningManage.do?action=display&result=" + success));
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.controller.WarningManageController
 * JD-Core Version:    0.6.0
 */